package com.boredom.Sloth;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

/**
 * Implements handling of the creation of a new Event object.
 * 
 * Created via startActivityForResult() by the 'New Event' sub-menu
 * item in the Main Menu. 
 * 
 * */
public class NewEventActivity extends Activity {

	public NewEventActivity() {
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.new_event);
		
		/**
		 * Dummy call that takes the content of the Event Name text field
		 * and sends it back to the calling activity.*/
		final Button button = (Button) findViewById(R.id.newEventCancelButton);
		button.setOnClickListener(new OnClickListener() {
		    public void onClick(View v) {
		    	
		    	EditText text = (EditText) findViewById(R.id.newEventNameField);
		    	
		        // Perform action on clicks
		        //Toast.makeText(HelloFormStuff.this, "Beep Bop", Toast.LENGTH_SHORT).show();
		    	Intent mIntent = new Intent();
		    	mIntent.putExtra("TEST_STRING", text.getText().toString());
		    	setResult(RESULT_OK, mIntent);
		    	finish();
		    }
		});
	}

}
